<template>
  <div class="app">
    <div class="home">
      <span class="home1">关注</span>
      <span class="home1">食谱</span>
      <span class="home1">推荐</span>
      <span class="home1">时尚美妆</span>
      <span class="home1">生活</span>
    </div>
    <div class="middle">
      <div class="middle1" v-for="(im,index) in middle" :key="index">
        <!-- <img src="" alt=""> -->
        <p>{{im.title}}</p>
        <span class="middle2">{{im.title1}}</span>
        <img :src="$baseImgUrl+'/uploads/'+im.img" alt />
        <span class="middle3">
          <img :src="$baseImgUrl+'/uploads/'+im.img1" alt />
          {{im.title2}}
        </span>
      </div>
      <div class="xiaotop1" v-for="(im,index) in xiaotop" :key="index+'a'">
        <img :src="$baseImgUrl+'/uploads/'+im.img" alt />
        <p>{{im.title}}</p>
        <span class="xiaotop2">{{im.title1}}</span>
        <span class="xiaotop3">
          <img :src="$baseImgUrl+'/uploads/'+im.img1" alt />
          {{im.title2}}
        </span>
      </div>
      <div class="middle1" v-for="(im,index) in middle" :key="index+'c'">
        <!-- <img src="" alt=""> -->
        <p>{{im.title}}</p>
        <span class="middle2">{{im.title1}}</span>
        <img :src="$baseImgUrl+'/uploads/'+im.img" alt />
        <span class="middle3">
          <img :src="$baseImgUrl+'/uploads/'+im.img1" alt />
          {{im.title2}}
        </span>
      </div>
      <div class="xiaotop1" v-for="(im,index) in xiaotop" :key="index+'b'">
        <img :src="$baseImgUrl+'/uploads/'+im.img" alt />
        <p>{{im.title}}</p>
        <span class="xiaotop2">{{im.title1}}</span>
        <span class="xiaotop3">
          <img :src="$baseImgUrl+'/uploads/'+im.img1" alt />
          {{im.title2}}
        </span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      middle: [],
      xiaotop: []
    };
  },
  created() {
    this.getMiddle();
    this.getXiaotop();
  },
  methods: {
    getXiaotop() {
      this.$api.getXiaotop(result => {
        this.xiaotop = result.data.data;
      });
    },
    getMiddle() {
      this.$api.getMiddle(result => {
        this.middle = result.data.data;
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.app {
  width: 100vw;
  height: 1000px;
  background-color: #f6f6f6;
  position: relative;
  .middle {
    width: 350px;
    height: 600px;
    // border: 1px solid red;
    position: absolute;
    top: 60px;
    left: 10px;
    .xiaotop1 {
      width: 350px;
      height: 132px;
      // border: 1px solid red;
      margin-top: 10px;
      background: #fff;
      position: relative;
      img {
        width: 132px;
        height: 132px;
        display: inline-block;
      }
      .xiaotop3 {
        width: 200px;
        height: 30px;
        font-size: 12px;
        color: #666;
        // border: 1px solid red;
        position: absolute;
        bottom: 0;
        right: 0;
        img {
          width: 20px;
          height: 20px;
          border-radius: 20px;
          line-height: 40px;
          vertical-align: middle;
          display: inline-block;
        }
      }
      .xiaotop2 {
        width: 200px;
        height: 20px;
        font-size: 12px;
        line-height: 20px;
        display: inline-block;
        // border: 1px solid red;
        position: absolute;
        top: 50px;
        right: 0;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        word-break: break-all;
      }
      p {
        width: 200px;
        height: 40px;
        display: inline-block;
        // border: 1px solid red;
        position: absolute;
        top: 0;
        right: 0;
        margin-top: 0;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        font-weight: bold;
      }
    }
    .middle1 {
      width: 350px;
      height: 320px;
      // border: 1px solid red;
      text-overflow: -o-ellipsis-lastline;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      margin-top: 10px;
      background: #fff;
      .middle3 {
        width: 350px;
        height: 40px;
        line-height: 40px;
        // border: 1px solid red;
        display: block;
        margin-top: 10px;
        img {
          width: 25px;
          height: 25px;
          border: 1px solid red;
          display: inline-block;
          border-radius: 20px;
          vertical-align: middle;
          margin-left: 10px;
        }
      }
      .middle2 {
        width: 350px;
        height: 40px;
        font-size: 14px;
        overflow: hidden;
        color: #666;
        //  border: 1px solid red;
        display: block;
        margin-left: 7px;
        margin-bottom: 10px;
      }
      img {
        width: 335px;
        height: 159px;
        display: block;
        margin-left: 7px;
      }
      p {
        width: 350px;
        height: 22px;
        font-weight: 800;
        margin-left: 7px;
        margin-bottom: 25px;
      }
    }
  }
  .home {
    width: 100%;
    height: 60px;
    line-height: 60px;
    text-align: center;
    // border: 1px solid red;
    background: #fff;
    position: absolute;
    top: 0px;
    .home1 {
      width: 68px;
      height: 50px;
      font-size: 16px;
      color: #333;
      // border: 1px solid red;
      display: inline-block;
    }
  }
}
</style>
<style lang="scss">
body {
  padding: 0px;
  margin: 0px;
}
</style>